package delete4;


import java.net.DatagramPacket;
import java.net.DatagramSocket;


//服务器端
public class UDP222 {
    public static void main(String[] args) throws Exception {

        DatagramSocket socket=new DatagramSocket(7474);
        while(true) {
            byte[] buffer = new byte[1024];
            DatagramPacket packet = new DatagramPacket(buffer, 0, buffer.length);
            socket.receive(packet);

            System.out.println(new String(packet.getData(),0,packet.getData().length));


            if (packet.equals("bye")){
                break;
            }

        }
        socket.close();



    }
}
